package day22;

import day16.AbstractCat;

import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;

public class Demo8 {
    //static volatile int counter = 0;
    static AtomicInteger count = new AtomicInteger(0);
    public static void main(String[] args) {
        ScheduledExecutorService ses = Executors.newScheduledThreadPool(1);
        System.out.println("点燃了樱花");
        ses.scheduleAtFixedRate(()->{
            count.getAndIncrement();
            System.out.println("开始发射"+count.get()+"烟花");
        },5,2, TimeUnit.SECONDS);
//        while (count.get() <= 12){}
        System.out.println("新年快乐");
        ses.shutdown();
    }
}
